package com.ruoyi.common.utils;

import java.util.regex.Pattern;

/**
 * 校验工具类
 */
public class ValidateUtils {
    public static final String PHONE_REGEX = "1[3-9][0-9]\\d{8}";
    public static final String LICENSEPLATE_REGEX = "[京津冀晋蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘粤桂琼川贵云渝藏陕甘青宁新]{1}[ABCDEFGHJKLMNOPQRSTUVWXY]{1}[0-9A-Z]{5}";

    public static boolean validPhone(String phone) {
        if (StringUtils.isEmpty(phone)) {
            return false;
        }
        return Pattern.matches(PHONE_REGEX,phone);
    }
    public static boolean validLicensePlate(String licensePlate) {
        if (StringUtils.isEmpty(licensePlate)) {
            return false;
        }
        return Pattern.matches(LICENSEPLATE_REGEX,licensePlate);
    }
}
